/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package DBFunction;

import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;

public class fOnlineStatus {
	public static void process(String OnlineJsonString) throws JSONException {
		JSONObject object = new JSONObject();
		object = (JSONObject) new JSONTokener(OnlineJsonString).nextValue();
		String phoneNumber = object.getString("phoneNumber");
		String status = object.getString("onlineStatus");
		if(status.equals("on")){
		String sql = "UPDATE buddytracking.user set IsOnline='1' where PhoneNumber='" + phoneNumber + "'";
		DB.connectDB.Update(sql);
		}
		else if(status.equals("off")){
			String sql = "UPDATE buddytracking.user set IsOnline='0' where PhoneNumber='" + phoneNumber + "'";
	DB.connectDB.Update(sql);
		}
	}
}
